<template>
	<view class="containers">
		 <scroll-view
		  :scroll-top="scrollTop"
		  scroll-y="true"
		  class="scroll-Y"
		  @scrolltoupper="upper"
		  @scrolltolower="lower"
		  @scroll="scroll"
		>
		<friend-select
			@cityClick="onClick"
			:formatName="formatName"
			:obtainCitys="obtainCitys"
			:isSearch="true"
			:placeholder="placeholder"
			ref="citys"
		></friend-select>
		</scroll-view>
	</view>
</template>

<script>
import friendSelect from '@/components/friend-select/friend-select.vue'
	export default{
		name: "m-friend",
		props: {
			datas: Array, //数据
		},
		data() {
			return {
				scrollTop: 0,
				  old: {
					scrollTop: 0
				  },
				//需要构建索引参数的名称（注意：传递的对象里面必须要有这个名称的参数）
				formatName: 'title',				
				//显示的城市数据
				obtainCitys: [
					{
						id: 0,
						title: '北京'
					}
				],
				citys:[]
			}
		},
		components: {
			friendSelect
		},
		created() {
			//修改数据格式
			this.formatName = 'cityName'
			this.placeholder = '好友/团队';
			//修改构建索引数据
			console.log(this.datas);
			this.obtainCitys = this.datas
				
		},
		methods: {		
			onClick(item) {
				 this.$emit('click', {
				 	model: item
				 })
			}
		}
		
	}
</script>

<style></style>